<template>
  <div class="repair-history">
    <el-row>
      <dynForm :info-form="searchForm" :search-tags="searchTags" :select-list="selectList">
        <el-button
          type="primary"
          icon="el-icon-search"
          @click="doSearch"
        >
          {{ $t("search") }}</el-button
          >
        <el-button
          v-btnPermission:add
          type="primary"
          icon="el-icon-download"
        >
          导出</el-button
          >
      </dynForm>
    </el-row>
    <el-card>
      <el-row>
        <dynTable
          ref="dynTable"
          :loading="tableLoading"
          :table-data="tableData"
          :table-columns="tableColumns"
        />
      </el-row>
      <!--分页组件-->
      <pagination
        :total="total"
        :page.sync="listQuery.page"
        :size.sync="listQuery.size"
        @pagination="getList"
      />
    </el-card>
    <dialogForm ref="historyInfoDialog"/>
  </div>
</template>

<script>
import mySetting from '@/mixins/mySetting'
import dialogForm from './components/FormInfo'
export default {
  name: 'RepairHistory',
  components: { dialogForm },
  mixins: [mySetting],
  data() {
    return {
      searchForm: {},
      searchTags: [
        { label: '设备编号', prop: 'name', tag: 'DynSelect' },
        { label: '提交部门', prop: 'name', tag: 'DynInput' },
        { label: '问题描述', prop: 'name', tag: 'DynSelect' },
        { label: '一级问题分类', prop: 'name', tag: 'DynSelect' },
        { label: '二级问题分类', prop: 'name', tag: 'DynSelect' },
        { label: '报修类型', prop: 'name', tag: 'DynSelect' },
        { label: '是否关闭', prop: 'name', tag: 'DynSelect' },
        { label: '报修时间', prop: 'timer', tag: 'Dyndaterange', event: (value) => {
          this.searchForm.startTime = Array.isArray(value) ? value[0] : null
          this.searchForm.endTime = Array.isArray(value) ? value[1] : null
        } }
      ],
      selectList: {},
      trackinTime: null,
      tableColumns: [
        { prop: '', label: '', type: 'selection' },
        { prop: '', label: '序号', type: 'index', width: '50px', templete: (_scope) => {
          return (
            <span>{ (this.listQuery.page - 1) * this.listQuery.size + _scope.$index + 1 }</span>
          )
        } },
        { prop: 'pmTypeName', label: '设备编号' },
        { prop: 'frequence', label: '提交部门' },
        { prop: 'frequenceNnit', label: '一级问题分类', width: '140px' },
        { prop: 'remark', label: '二级问题分类', width: '140px' },
        { prop: 'status', label: '报修类型' },
        { prop: 'isclose', label: '是否关闭' },
        { prop: 'creator', label: '报修人' },
        { prop: 'createTime', label: '报修时间', width: '200px' },
        { prop: '', label: '操作', width: '140px', templete: (_scope) => {
          return (
            <span>
              <el-link type='primary' underline={false}>接手</el-link>
              <el-link type='primary' underline={false}>转交</el-link>
              <el-link type='primary' underline={false}>关闭</el-link>
            </span>
          )
        } },
        { prop: '', label: '查看详情', templete: (_scope) => {
          return (
            <el-link type='primary' underline={false}>查看详情</el-link>
          )
        } }
      ],
      tableLoading: true
    }
  },
  created() {
    this.tableLoading = false
  },
  methods: {
    doSearch() {
      delete this.searchForm.timer
    }
  }
}
</script>

<style scoped lang="scss">
@import "~@/assets/styles/defaultStyle.scss";
::v-deep .el-row:nth-child(1) {
  padding-bottom: 0;
}
</style>
